/*
 * @Author: 赵广成 76118299@qq.com
 * @Date: 2024-09-17 08:57:04
 * @LastEditors: 赵广成 76118299@qq.com
 * @LastEditTime: 2024-10-13 10:28:11
 * @FilePath: \tianhe\src\store\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { createStore } from 'vuex'
import router from '@/router';
export default createStore({
  state: {
    
    editableTabsValue:"/index",
    editableTabs:[
      {
        title:"首页",
        name:"/index"
      }
    ]
  },
  getters: {
    

  },
  mutations: {
 
  

    ADD_TABS:(state,tab)=>{
    
       if(state.editableTabs.findIndex(e=>e.name===tab.path)===-1){
        state.editableTabs.push(
          {
            title:tab.menuName ,
            name:tab.path
          }
        );
        state.editableTabsValue=tab.path;

       }
    },
    REST_TABS:(state)=>{
      state.editableTabsValue="/index";
      state.editableTabs=[
        {
          title:"首页",
          name:"/index"
        }
      ];
    }
  },
  actions: {
    logout(){
      window.sessionStorage.clear();
      router.replace("/login")
      
    }
  },
  modules: {
  }
})
